<?php
namespace  app\http\Service\Agent;

use App\Http\Service\Basic\BasicService;
use Config;

class AgentService extends BasicService
{
    //构造函数
    function __construct(){
        parent::__construct();
    }

    /**
     * @return bool|mixed
     * 代理汇总
     */
    public function getUserInfo($where)
    {
        $url='';

        if(isset($where['token'])){
            $url .='?token='.$where['token'];
        }
//dd(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.userinfo').$url);
        return  $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH'  ).Config::get('custom.api.userinfo').$url);

    }




    /**
     * @param $where
     * @return bool|mixed
     * 一级用户
     */
    public function getUserList($where)
    {

        $url='';

        if(isset($where['token'])){
            $url .='?token='.$where['token'];
        }

        return  $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.getuserlist').$url);

    }


    /**
     * @param $where
     * @return bool|mixed
     * 产品列表
     */
    public function productList()
    {
        return  $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.productlist'));

    }


    public function OpenUser($where)
    {
//        dd(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.OpenUser'), json_encode($where));
    
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.OpenUser'), json_encode($where), 'post');

    }


    public function userInfo($user_id)
    {
        $url = '';
        $url .='?user_id='.$user_id;

        return  $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.user_info').$url);

    }


    public function RenewUser($where)
    {
//        dd(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.RenewUser'), json_encode($where));
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.RenewUser'), json_encode($where), 'post');
    }


    public function discount($where)
    {
        $url='';

        if(isset($where['token'])){
            $url .='?token='.$where['token'];
        }
//        dd(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.discount').$url);
        return  $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH').Config::get('custom.api.discount').$url);
    }






}







